home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / bsnews / gethost.c next >
C/C++ Source or Header  |  1989-08-23  |  743b  |  36 lines

  1. /*
  2.  * gethost.c - get the name of the feeder site for bootstrap news
  3.  * copyright 1989 Ronald Florence (ron@mlfarm 7/9/89)
  4.  *
  5.  * The original package got the host name from a compile-time constat.
  6.  * Since many people may not want to re-compile this, we get the name
  7.  * from a file.
  8.  * by David Beckemeyer (david@bdt 8/23/89)
  9.  * 
  10.  */
  11.  
  12. #include <stdio.h>
  13.  
  14. #define SYSFILE    "\\usr\\lib\\news\\sys"
  15.  
  16. char *feedhost()
  17. {
  18.     FILE *fp;
  19. static char host[32];
  20.     char *p;
  21.  
  22.     if ((fp = fopen(SYSFILE, "r")) == 0) {
  23.         printf("cannot open %s\n", SYSFILE);
  24.         exit(1);
  25.     }
  26.     if (!fgets(host, 32, fp)) {
  27.         printf("cannot read %s\n", SYSFILE);
  28.         exit(1);
  29.     }
  30.     fclose(fp);
  31.     for (p = host; *p > ' '; p++)
  32.         ;
  33.     *p = 0;
  34.     return(host);
  35. }
  36.